<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <script src="../plugins/echarts/echarts.js"></script>
    <!--element日期所需-->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <link rel="stylesheet" href="../plugins/elementui/index.css">
</head>
<body class="hold-transition">
<!--日期控件-->

<div id="app">
    <div class="content-header">
        <h1>年龄分布</h1>
    </div>
    <div class="app-container">
        <div class="box">
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>
        </div>
    </div>
</div>
</body>

<script src="../js/axios-0.18.0.js"></script>
<script>
    var myChart = echarts.init(document.getElementById('chart1'));
    axios.get("/report/getAgeGroup").then((res) => {
        myChart.setOption(
            {
                xAxis: {
                    type: 'category',
                    data: res.data.data.ageGroup
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: res.data.data.num,
                    type: 'bar',
                    showBackground: true,
                    backgroundStyle: {
                        color: 'rgba(220, 220, 220, 0.8)'
                    }
                }]
            });
    });
</script>

</html>
